// import com.alibaba.druid.sql.ast.*;
// import com.alibaba.druid.sql.ast.expr.*;
// import com.alibaba.druid.sql.ast.statement.*;
// import com.alibaba.druid.sql.dialect.hive.parser.HiveCreateTableParser;
// import com.alibaba.druid.sql.dialect.hive.stmt.HiveCreateTableStatement;
// import com.alibaba.druid.sql.dialect.mysql.ast.*;
// import com.alibaba.druid.sql.dialect.mysql.ast.expr.MySqlOutFileExpr;
// import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlSelectQueryBlock*;
// import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlUpdateStatement*;
// import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlUpdateTableSource;
// import com.alibaba.druid.sql.parser.*;
// import com.alibaba.druid.util.FnvHash;

// import java.util.ArrayList;
// import java.util.std::list;
#pragma once
#include "../../../parser/SQLSelectParser.h"
#include "../../../../utils/common_ptr.h"

class MySqlUpdateStatement;
class SQLSelectListCache;
// class MySqlIndexHintImpl;
// class MySqlExprParser;

class MySqlSelectParser : public SQLSelectParser
{
public:
  BOOL_ptr returningFlag;
  MySqlUpdateStatement_ptr updateStmt;

  MySqlSelectParser(SQLExprParser_ptr exprParser);

  MySqlSelectParser(SQLExprParser_ptr exprParser, SQLSelectListCache_ptr selectListCache);

  MySqlSelectParser(string_ptr sql);

  void parseFrom(SQLSelectQueryBlock_ptr queryBlock) override;

  SQLSelectQuery_ptr query(SQLObject_ptr parent, BOOL_ptr acceptUnion) override;
  SQLTableSource_ptr parseTableSource() override;
  SQLTableSource_ptr parseTableSource(SQLObject_ptr parent);

  MySqlUpdateStatement_ptr parseUpdateStatment();

  void parseInto(SQLSelectQueryBlock_ptr queryBlock);

  SQLTableSource_ptr primaryTableSourceRest(SQLTableSource_ptr tableSource);

  SQLTableSource_ptr parseTableSourceRest(SQLTableSource_ptr tableSource) override;

  void parseIndexHintList(SQLTableSource_ptr tableSource);

  // void parseIndexHint(MySqlIndexHintImpl *hint);

  std::shared_ptr<SQLUnionQuery> unionRest(std::shared_ptr<SQLUnionQuery> union_) override;

  // MySqlExprParser *getExprParser();
};
